set(EXE simple)
cmake_minimum_required(VERSION 2.8)

project(${EXE})

file(GLOB SOURCES src/*.cpp src/*.h)

find_package(OpenGL REQUIRED)
find_package(SDL2 REQUIRED)
find_package(GLEW REQUIRED)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -fno-rtti")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g")

if(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_RELEASE} -mwindows")
endif()

if(MINGW)
set(LIBS ${MINGW32_LIBRARY})
endif()

set(LIBS "${LIBS} ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY} ${GLEW_LIBRARY} ${OPENGL_LIBRARIES}")

include_directories(src ${SDL2_INCLUDE_DIR} ${GLEW_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})

add_executable(bin/${EXE} ${SOURCES})

target_link_libraries(bin/${EXE} ${LIBS})
